﻿#region Creditos

/* Autor: Edilberto Sánchez Forero	*/
/* Email: esanchezfo@gmail.com		*/
/* Licencia: Propietario			*/
/* País: Colombia, Bogotá			*/

#endregion

#region Librerias

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using ESF.General.MVP;
using ESF.SSO.Core.Entities.Log;
using ESF.SSO.Web.Tools.SSOServiceClient;
using ESF.SSO.Web.Tools.Modules;

#endregion 


namespace ESF.SSO.Web.Tools.Presenter
{
	public class LoginViewPresenter : BasePresenter<ILoginViewViewer>
	{
		#region Constructor
		
		public LoginViewPresenter (ILoginViewViewer pViewer) : base (pViewer) {}
		
		#endregion
		
		
		#region Funciones

		public void CloseSession ()
		{
			try
			{
				using (SSOServiceClient.SSOServiceClient ssoClient = new SSOServiceClient.SSOServiceClient ())
				{				
					ssoClient.CloseSession (new UserSessionLog () { ID = _Viewer.UserSessionID });
				}
				
				_Viewer.ClearSession ();
			}
			catch (Exception pEx)
			{
				LogError (pEx);
			}
		}
		
		#endregion
	}
}
